

import org.junit.AfterClass
import org.junit.BeforeClass
import org.junit.Test
import org.openqa.selenium.By
import org.openqa.selenium.WebDriver
import org.openqa.selenium.firefox.FirefoxDriver

import static org.junit.Assert.assertEquals

class GetTitleReplacementExerciseTest {

    static WebDriver driver
    static PROTOCOL = "http"
    static HOST = "www.compendiumdev.co.uk"

    @BeforeClass
    static void createDriver()
    {
        driver = new FirefoxDriver()
    }

    @Test
    void shouldTestSomeByWithId()
    {
        driver.navigate().to("http://compendiumdev.co.uk/selenium/find_by_playground.php")
        def someElement = driver.findElement(By.tagName("title"))
        assertEquals("Could not find expected element with tag name bla bla on element " + someElement,
                "Welcome to the Find By Playground", someElement.getText())
    }

    @AfterClass
    static void quitDriver()
    {
        driver.quit()
    }

}

